/**
 * xdemo.org
 */
package org.xdemo.site.biz.portal.demo.bean;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;
import org.xdemo.site.biz.portal.profile.bean.Account;

/**
 * @作者 Goofy
 * @邮件 252878950@qq.com
 * @日期 2013-12-31
 * @描述：Demo文章
 */
@Entity
@Table(name="demo")
public class Demo {
	
	@Id
	@GenericGenerator(name="idGenerator",strategy="uuid")//ID生成器属性包括生成器ID，生成策略
	@GeneratedValue(generator="idGenerator")//引用ID生成器
	@Column(length=64)
	private String demoId;
	/**
	 * 标题
	 */
	@Column(nullable=false,length=1024)
	private String title;
	/**
	 * 关键字
	 */
	@Column(nullable=true,length=256)
	private String keyWords;
	/**
	 * 摘要
	 */
	@Column(nullable=false,columnDefinition="TEXT")
	private String summary;
	/**
	 * 文章内容
	 */
	@Column(nullable=true,columnDefinition="TEXT")
	private String content;
	/**
	 * 发布者认领的key
	 */
	@Column(nullable=true,length=128,unique=true)
	private String contentKey;
	/**
	 * 程序语言
	 */
	@Column(nullable=false,length=32)
	private String programeLanguage;
	/**
	 * 是否转载 0：原创，1：转载
	 */
	@Column(nullable=false,length=2)
	private int reprint;
	/**
	 * 转载地址
	 */
	@Column(nullable=false,length=1024)
	private String reprintURL;
	/**
	 * 静态页路径
	 */
	@Column(nullable=false,length=512)
	private String staticPagePath;
	/**
	 * 附件
	 */
	@OneToMany(mappedBy="demo")//demo对应demoAttachment中的demo
	private List<DemoAttachment> demoAttachmentList;
	
	/**
	 * 发布者 设置用户扩展信息的外键，一对一单向关联
	 */
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="accountId")
	private Account account;

	public String getDemoId() {
		return demoId;
	}

	public void setDemoId(String demoId) {
		this.demoId = demoId;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getKeyWords() {
		return keyWords;
	}

	public void setKeyWords(String keyWords) {
		this.keyWords = keyWords;
	}

	public String getSummary() {
		return summary;
	}

	public void setSummary(String summary) {
		this.summary = summary;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getContentKey() {
		return contentKey;
	}

	public void setContentKey(String contentKey) {
		this.contentKey = contentKey;
	}

	public String getProgrameLanguage() {
		return programeLanguage;
	}

	public void setProgrameLanguage(String programeLanguage) {
		this.programeLanguage = programeLanguage;
	}

	public int getReprint() {
		return reprint;
	}

	public void setReprint(int reprint) {
		this.reprint = reprint;
	}

	public String getReprintURL() {
		return reprintURL;
	}

	public void setReprintURL(String reprintURL) {
		this.reprintURL = reprintURL;
	}

	public String getStaticPagePath() {
		return staticPagePath;
	}

	public void setStaticPagePath(String staticPagePath) {
		this.staticPagePath = staticPagePath;
	}

	public List<DemoAttachment> getDemoAttachmentList() {
		return demoAttachmentList;
	}

	public void setDemoAttachmentList(List<DemoAttachment> demoAttachmentList) {
		this.demoAttachmentList = demoAttachmentList;
	}

	public Account getAccount() {
		return account;
	}

	public void setAccount(Account account) {
		this.account = account;
	}
	
}
